/*
 * Copyright (c) 2006, 2022, webrx.cn All rights reserved.
 *
 */
package cn.webrx;

/**
 * <p>Project: javase202202 - Switch3
 * <p>Powered by Lisi On 2022-06-01 10:00:17
 * <p>Created by IntelliJ IDEA
 *

 * @version 1.0
 * @since 17
 */
public class Switch3 {
    public static void main(String[] args) {
        int year = 2020;
        int month = 3;
        int days = 31;
        switch (month) {
            case 4:
            case 6:
            case 9:
            case 11:
                days = 30;
                break;
            case 2:
                days = year % 400 == 0 || year % 4 == 0 && year % 100 != 0 ? 29 : 28;
                break;
            default:
                days = 31;
                break;
        }
        System.out.printf("%d年%02d月有%d天。%n", year, month, days);
    }
}
